home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / 2-nroff.template < prev    next >
Text File  |  1993-03-03  |  6KB  |  226 lines

  1. Internet-Draft                        J. Postel
  2.                             24-June-91    
  3.             RFC "nroff macros"    
  4.  
  5.  
  6. Status
  7.  
  8. This odd Internet Draft is posted for the convenience of authors who
  9. wish to prepare documents in the style of RFC's.  This style is
  10. compatable with Internet Drafts with the addition of a few guidelines
  11. listed in the file IETF/1id-guidelines in all the IETF directories.
  12.  
  13.  
  14.  
  15.  
  16. Generally, we use the very simplest nroff features.  We use the "ms"
  17. macros.  So, "nroff -ms input-file > output-file".  However, we could not
  18. get nroff to do the right thing about putting a form feed after the last
  19. visible line on a page and no extra line feeds before the first visible
  20. line of the next page.  We want:
  21.  
  22.     last visible line on page i
  23.     ^L
  24.     first visible line on page i+1
  25.  
  26. So, we invented some hacks to fix this including a "sed" script called 
  27. "fix.sh" and a "c" program we called "pg" (pg is called from fix).  So 
  28. the command to process the file becomes:
  29.  
  30.     nroff -ms input-file | fix.sh > output-file
  31.  
  32. Now as to the nroff features we actually use, I'll append a sample memo,
  33. prepared in RFC style.
  34.  
  35. The sed script fix.sh is:
  36.  
  37.     sed -e 's/FORMFEED\[Page/         \[Page/' $* | pg -n5
  38.  
  39. The pg program is:
  40.  
  41. ~Begining of pg program~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42.  
  43. /*
  44.  *  $Header$
  45.  *
  46.  *  Remove N lines following any line that contains a form feed (^L).
  47.  *  (Why can't this be done with awk or sed?)
  48.  *
  49.  *  OPTION:
  50.  *    -n#    Number of lines to delete following each ^L (0 default).
  51.  * $Log$
  52.  */
  53. #include <stdio.h>
  54.  
  55. #define FORM_FEED    '\f'
  56. #define OPTION        "n:N:"        /* for getopt() */
  57.  
  58. extern char *optarg;
  59. extern int optind;
  60.  
  61. main(argc, argv)
  62. int    argc;
  63. char    *argv[];
  64. {
  65.   int    c,                /* next input char */
  66.     nlines = 0;            /* lines to delete after ^L */
  67.   void    print_and_delete();        /* print line starting with ^L,
  68.                        then delete N lines */
  69.  
  70. /*********************** Process option (-nlines) ***********************/
  71.  
  72.   while ((c = getopt(argc, argv, OPTION)) != EOF)
  73.     switch(c)
  74.     {
  75.       case 'n' :
  76.       case 'N' :  nlines = atoi(optarg);
  77.           break;
  78.     }
  79. /************************* READ AND PROCESS CHARS **********************/
  80.  
  81.   while ((c = getchar()) != EOF)
  82.     if (c == FORM_FEED)
  83.       print_and_delete(nlines);        /* remove N lines after this one */
  84.     else
  85.       putchar(c);            /* we write the form feed */
  86.   exit(0);
  87. }
  88.  
  89.  
  90. /*
  91.  *  Print rest of line, then delete next N lines.
  92.  */
  93. void print_and_delete(n)
  94. int  n;                    /* nbr of lines to delete */
  95. {
  96.   int    c,                /* next input char */
  97.     cntr = 0;            /* count of deleted lines */
  98.  
  99.   while ((c = getchar()) != '\n')    /* finish current line */
  100.     putchar(c);
  101.   putchar('\n');            /* write the last CR */
  102.   putchar(FORM_FEED);
  103.  
  104.   for ( ; cntr < n; cntr++)
  105.     while ((c = getchar()) != '\n')
  106.       if (c == EOF)
  107.     exit(0);            /* exit on EOF */
  108.   putchar(c);                /* write that last CR */
  109. }
  110.  
  111. ~End of pg program~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112.  
  113. Hope this helps,
  114.  
  115. - --jon.
  116.  
  117.  
  118. ~Begining of sample nroff RFC~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  119. .pl 10.0i
  120. .po 0
  121. .ll 7.2i
  122. .lt 7.2i
  123. .nr LL 7.2i
  124. .nr LT 7.2i
  125. .ds LF Drissel
  126. .ds RF FORMFEED[Page %]
  127. .ds CF
  128. .ds LH RFC DRAFT
  129. .ds RH February 1987
  130. .ds CH
  131. .hy 0
  132. .ad l
  133. Network Working Group                                         W. Drissel
  134. Request for Comments: DRAFT                       CyberScribe Associates
  135.                                                            February 1987
  136. .sp  2
  137. .ce
  138. Final Report of ANSI Committee LY-2299-BS
  139. .sp 2
  140. .fi
  141. .ne 4
  142. Status of this Memo
  143. .sp
  144. .in 3
  145. This RFC is being distributed to members of the 
  146. Internet community in order to solicit their reactions 
  147. to the proposals contained in it.  While the issues 
  148. discussed may not be directly relevant to the research 
  149. problems of the Internet, they may be interesting to a 
  150. number of researchers and implementers. 
  151. Distribution of this memo is unlimited.
  152. .sp
  153. .in 0
  154. .ne 4
  155. Proposed ANSI Standard Mendacity Scale
  156. .sp
  157. .nf
  158.     Class I     Lies
  159.     Class II    Damn Lies
  160.     Class III    Statistics
  161.     Class IV    Damn Statistics
  162.     Class V        Benchmarks
  163.     Class VI    Delivery Promises
  164.     Class VII    Campaign Promises
  165. .fi
  166. .sp
  167. .in 0
  168. .ne 4    
  169. Discussion
  170. .sp
  171. .in 3
  172. The committee felt it desirable to include the following explanatory notes:
  173.  
  174. (1)  Class IV lies are distinguished from Class III lies by the willful
  175. abuse statistical practice.  For example, "Brand A lasts up to twice
  176. as long as the average of the five leading brands".  This example 
  177. compares the one best sample of Brand A with an average -- trying to 
  178. give the impression of the superiority when a comparison of the 
  179. average of Brand A and the rest  may have demonstrated an inferiority.
  180. A second example is "Brand A lasts longer -- 30.3 months compared 
  181. with 30.2 months for the competition".  This example ignores the 
  182. principle of statistical significance.
  183.  
  184. (2) Class VII lies are distinguished from Class VI lies by the 
  185. fact that nearly every delivery promise is EVENTUALLY followed by 
  186. delivery.
  187. .sp
  188. .in 0
  189. .ne 4
  190. Author's Note:
  191. .sp
  192. .in 3
  193. I've embellished the original scale but have, unfortunately, forgotten
  194. its source.  If anyone can find the original reference, please send 
  195. it to me so the original author can be suitably remembered in the standard.
  196. .sp
  197. .in 0
  198. Security Considerations
  199. .sp
  200. .in 3
  201. Security considerations ane not discussed in this memo.
  202. .in 0
  203. .ne 5
  204. Author's  Address:
  205. .sp
  206. .in 3
  207. .nf
  208. William E. Drissel
  209. CyberScribe Associates
  210. Grand Prairie, Texas
  211. .fi
  212. .sp
  213. .in 0
  214. Editor's Note:
  215. .sp
  216. .in 3
  217. This report is reprinted from IEEE Computer, February 1987.
  218. ~End of sample nroff RFC~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  219.  
  220.  
  221.  
  222.  
  223.  
  224. ------- End of Forwarded Message
  225.  
  226.